package logic

import (
	"context"

	"dnsresolver/internal/svc"
	"dnsresolver/internal/types"
	"dnsresolver/rpc/dnsresolver"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetAddressListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetAddressListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAddressListLogic {
	return &GetAddressListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *GetAddressListLogic) GetAddressList(req *types.GetAddressListReq) (resp *types.GetAddressListResp, err error) {
	l.svcCtx.Rpc.Ping(l.ctx, &dnsresolver.Request{
		Ping: req.Service,
	})
	return
}
